Find a tuple with smallest second indexΒΆ
Find a tuple, the smallest second index value from a list of tuples.
LOT = [(4, 1), (1, 2), (6, 0)]
print(min(LOT, key=lambda n: (n[1], -n[0]))) # (6, 0)
LOT = [(4, 1), (1, 2), (6, 0)]
print(min(LOT, key=lambda n: (n[1], -n[0]))) # (6, 0)